<template>
<Row class="layout-content-body">
    <dtable :columnsList="columns" v-model="dataAll" :totals="total" 
    check  read  
    @get="get" @refresh="getall()" :loading="loading"></dtable>
    <Modal v-model="flag"  title="确认取件"  @on-ok="ansyOk">
        <Form ref="editForm" :model="formItem" :label-width="80" label-position="left">
                <Form-item label="取件人">
                    <Input v-model="formItem.User" placeholder="请输入手机号码"></Input>
                </Form-item>
                <Form-item label="手机号码">
                    <Input v-model="formItem.Phone" placeholder="请输入手机号码"></Input>
                </Form-item>
                 <Form-item label="备注">
                    <Input v-model="formItem.Remark" placeholder=""></Input>
                </Form-item>
        </Form>
    </Modal>
</Row>
</template>

<script>
// import { timeFormat, currency } from '@/common/filter'
import dtable from '@/components/table/etable.vue' // 采用biztable
import moment from 'moment'
export default {
    data () {
        return {
            loading: false, // 数据刷新遮罩层
            columns: [
        // 多选框
                {
                    title: '案件名称',
                    key: 'case_name'
                },
                {
                    title: '案件编号',
                    key: 'no'
                },
                {
                    title: '单位',
                    key: 'dept_name'
                },
                {
                    title: '送件人',
                    key: 'creater'
                },
                {
                    title: '结束时间',
                    key: 'ctime',
                    render: (h, params) => {
                        return h('span', {}, moment(params.row.ctime).format('YYYY-MM-DD HH:mm'))
                    }
                },
                {
                    title: '物证信息',
                    key: 'content'
                },
                {
                    title: '状态',
                    key: 'name'
                },
                {
                    title: '操作',
                    render: (h, params) => {
                        return h('div', [
                            h('Button', {
                                props: {
                                    type: 'primary',
                                    size: 'small'
                                },
                                style: {
                                    marginRight: '5px'
                                },
                                on: {
                                    click: () => {
                                        this.formItem.Id = params.row.id
                                        this.formItem.User = params.row.appoint_user
                                        this.formItem.Phone = ''
                                        this.next()
                                    }
                                }
                            }, '确认取件')
                        ])
                    }

                }
            ], // 表格样式
            dataAll: [], // 表格数据来源
            templist: [],
            dataShow: true, // 是否显示表格数据查看表单
            showTemp: false,
            total: 0,
            orderData: {
                edit: true,
                temp: ''
            },
            jyType: [
                {
                    name: '痕迹',
                    value: 0,
                    children: [
                        {
                            name: '手印',
                            value: 0
                        },
                        {
                            name: '足迹',
                            value: 1
                        },
                        {
                            name: '工具',
                            value: 2
                        },
                        {
                            name: '枪弹',
                            value: 3
                        },
                        {
                            name: '特殊',
                            value: 4
                        },
                        {
                            name: '爆炸',
                            value: 5
                        },
                        {
                            name: '其它',
                            value: 6
                        }
                    ]
                },
                {
                    name: '法医',
                    value: 1,
                    children: [
                        {
                            name: '尸体',
                            value: 0
                        },
                        {
                            name: '活体',
                            value: 1
                        },
                        {
                            name: '其它',
                            value: 2
                        }
                    ]
                },
                {
                    name: 'DNA',
                    value: 2,
                    children: [
                        {
                            name: '案件检验',
                            value: 0
                        },
                        {
                            name: '违法犯罪人员血样',
                            value: 1
                        },
                        {
                            name: '其它',
                            value: 2
                        }
                    ]
                },
                {
                    name: '理化',
                    value: 3,
                    children: [
                        {
                            name: '毒品',
                            value: 0
                        },
                        {
                            name: '毒物',
                            value: 1
                        },
                        {
                            name: '微量物证',
                            value: 2
                        },
                        {
                            name: '酒精含量',
                            value: 3
                        },
                        {
                            name: '其它',
                            value: 4
                        }
                    ]
                },
                {
                    name: '文检',
                    value: 4,
                    children: [
                        {
                            name: '笔记',
                            value: 0
                        },
                        {
                            name: '印章',
                            value: 1
                        },
                        {
                            name: '其他',
                            value: 2
                        }
                    ]
                },
                {
                    name: '电子物证',
                    value: 5,
                    children: [
                        {
                            name: '手机',
                            value: 0
                        },
                        {
                            name: '电脑',
                            value: 1
                        },
                        {
                            name: '存储设备',
                            value: 2
                        },
                        {
                            name: '其它',
                            value: 3
                        }
                    ]
                }
            ],
            jyCategory: [],
            flag: false,
            formItem: {
                Id: '',
                User: '',
                Phone: '',
                Remark: ''
            }
        }
    },
    components: {
        dtable
    },
    computed: {},
    watch: {},
    methods: {
        ansyOk () {
            console.log(this.formItem)
            this.$api.UpdateTodoStatus(this.formItem).then(res => {
                if (res.code === 0) {
                    console.log('success')
                    this.getall()
                }
            })
        },
        next () {
            this.flag = true
        },
        getall () {
            this.loading = true
            let data = {
                busyName: 'sf_case'
            }
            this.$api.GetDaiQuJian(data).then(res => {
                console.debug(res.Data)
                if (!res.error) {
                    this.dataAll = res.Data
                    if (this.dataAll) {
                        this.total = this.dataAll.length
                    }
                } else {
                    this.$Message.error(res.message)
                }
            })
            this.loading = false
        },

        get (data) {
            console.log(data)
            this.orderData.order = data
            this.orderData.edit = false
            this.$router.push({
                name: '司法检验审核',
                params: {
                    orderData: this.orderData
                }
            })
        }
    },
    mounted () {
        // this.getall()
    }
}
</script>
